<template>
  <el-dialog :title="title" width="1300px" append-to-body>
    <div class="app-container">
      <el-table v-loading="loading" :data="tableData">
        <el-table-column width="100" label="产品编号" align="center" prop="productId"/>
        <el-table-column width="110" label="产品名称" align="center" prop="product"/>
        <el-table-column width="110" label="产品区域" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="出发地" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="目的地" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="出发班期" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="出发日期" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="行程天数" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="最低价" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="产品形态" align="center" prop="mobileTelNum"/>
        <el-table-column width="110" label="销售状态" align="center" prop="mobileTelNum"/>
        <el-table-column label="操作" align="center" fixed="right" class-name="small-padding fixed-width" width="130">
          <template slot-scope="scope">
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleUpdate(scope.row)"
            >修改
            </el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleDelete(scope.row)"
            >删除
            </el-button>
            <el-button
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="handleSet(scope.row)"
            >设置销售计划
            </el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination
        v-show="total>0"
        :total="total"
        :page.sync="queryParams.pageNum"
        :limit.sync="queryParams.pageSize"
        @pagination="getList"
      />
    </div>
  </el-dialog>
</template>

<script>
import {pageList} from "@/api/product/tourproduct"
export default {
  name: "tourproduct",
  components: {},
  data() {
    return {
      // 弹出层标题
      title: "",
      // 遮罩层
      loading: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 表格数据
      tableData: [],
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        saleOrderId: '',
      },
    }
  },
  created() {
    this.getList()
  },
  methods: {
    open(saleOrderId,ycContract) {
      this.sendSms.contractNumber=ycContract
      this.queryParams.saleOrderId=saleOrderId
      this.title = "产品详情"
      this.getList()
    },
    getList() {
      this.loading = true
      pageList(this.queryParams).then(response => {
          this.tableData = response.rows
          this.total = response.total
          this.loading = false
        }
      )
    },
    handleDelete(row) {
      this.$modal.confirm('是否确认删除' + row.contractId + '？').then(function () {
        return cancelContract(row.id);
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {
      })
    },
    handleUpdate(row) {
      this.$modal.confirm('是否确认删除' + row.contractId + '？').then(function () {
        return cancelContract(row.id);
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {
      })
    },
    handleSet(row) {
      this.$modal.confirm('是否确认删除' + row.contractId + '？').then(function () {
        return cancelContract(row.id);
      }).then(() => {
        this.getList()
        this.$modal.msgSuccess("删除成功")
      }).catch(() => {
      })
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1
      this.getList()
    },

    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm")
      this.handleQuery()
    },
  }
}
</script>
